lib.use(['element', 'table', 'form'], function () {
    var table = layui.table;
    var layer = layui.layer;
    var form = layui.form;
    var uomTable;

    // 渲染表格
    var renderTable = function (postData) {
        layer.load(2);
        uomTable = table.render({
            elem: '#uomTable'
            , url: common.util.createUrl('/base/uom/list')
            // 对分页请求的参数：page、limit重新设定名称
            ,request: common.layui.table.tableRequest
            , page: true
            , height: 'full-55'
            , where: postData
            , cellMinWidth: 100 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
            , cols: [[
                  {type:'checkbox'}
                , {type: 'numbers', title: '编号'}
                , {field: 'id',  hide:true}
                , {field: 'uomName', title: '计量位单',  minwidth: 80}


            ]]
            ,parseData: common.layui.table.tableParseData
           /* ,done: function () {
                layer.closeAll('loading');
            }*/
        });


    };

    form.on('submit(searchFilter)', function(data){
        var param = data.field;
        searchTable(param)
        return false;
    });

    searchTable();

    /**
     * 查询表格
     * @param params
     */
    function searchTable(params) {
        if(!params){
            params=common.from.serializeObject('#searchFrm');
        }
        if (!uomTable) {
            uomTable = renderTable(params);
        } else {
            uomTable.reload({
                where: params
            })
        }
    }


});
